# -*- coding: utf-8 -*
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
#mysql配置
engine = create_engine('mysql+mysqlconnector://asplayer:Asplayer2016@rm-wz9n817r7d5ksg2ctgo.mysql.rds.aliyuncs.com:3306/task_master_mmobi',
                        encoding='utf-8',
                        echo=False,
                        pool_size=100,
                        pool_recycle=10,
                        connect_args={'charset': 'utf8'}
                       )
#创建session
class Db:
    @classmethod
    def db(cls):
        Session = sessionmaker(
            bind=engine,
            autocommit=False,
            autoflush=True,
            expire_on_commit=False
        )
        session = Session()
        return session
session=Db.db()
Base = declarative_base()
metadata = Base.metadata
